package com.dili.dd.gpi.mapper;

import com.dili.dd.gpi.domain.Event;
import com.dili.dd.gpi.domain.EventExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface EventMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int countByExample(EventExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int deleteByExample(EventExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    @Delete({
        "delete from event",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    @Insert({
        "insert into event (appkey, event_id, ",
        "event_name)",
        "values (#{appkey,jdbcType=VARCHAR}, #{eventId,jdbcType=VARCHAR}, ",
        "#{eventName,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Event record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int insertSelective(Event record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    List<Event> selectByExample(EventExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    @Select({
        "select",
        "id, appkey, event_id, event_name",
        "from event",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    Event selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int updateByExampleSelective(@Param("record") Event record, @Param("example") EventExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int updateByExample(@Param("record") Event record, @Param("example") EventExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    int updateByPrimaryKeySelective(Event record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table event
     *
     * @mbggenerated Wed Oct 14 14:27:53 CST 2015
     */
    @Update({
        "update event",
        "set appkey = #{appkey,jdbcType=VARCHAR},",
          "event_id = #{eventId,jdbcType=VARCHAR},",
          "event_name = #{eventName,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Event record);
}